package abstractEntities;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;

import entities.Tutorial;
import entities.User;

/**
 * AbstractComplaint entity provides the base persistence definition of the
 * Complaint entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractComplaint implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -6901012086095034323L;
	private Integer idComplaint;
	private Tutorial tutorial;
	private User user;
	private Date dateComplaint;
	private String text;
	private Integer type;
	private Integer state;

	// Constructors

	/** default constructor */
	public AbstractComplaint() {
	}

	/** full constructor */
	public AbstractComplaint(Tutorial tutorial, User user, Date dateComplaint,
			String text, Integer type, Integer state) {
		this.tutorial = tutorial;
		this.user = user;
		this.dateComplaint = dateComplaint;
		this.text = text;
		this.type = type;
		this.state = state;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idComplaint", unique = true, nullable = false)
	public Integer getIdComplaint() {
		return this.idComplaint;
	}

	public void setIdComplaint(Integer idComplaint) {
		this.idComplaint = idComplaint;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idTutorial", nullable = false)
	public Tutorial getTutorial() {
		return this.tutorial;
	}

	public void setTutorial(Tutorial tutorial) {
		this.tutorial = tutorial;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idUser", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "dateComplaint", nullable = false, length = 10)
	public Date getDateComplaint() {
		return this.dateComplaint;
	}

	public void setDateComplaint(Date dateComplaint) {
		this.dateComplaint = dateComplaint;
	}

	@Column(name = "text", nullable = false)
	public String getText() {
		return this.text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Column(name = "type", nullable = false)
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "state", nullable = false)
	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

}